﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reap.Common.Runtime.Dependency {
	/// <summary>
	/// 容器接口
	/// </summary>
	public interface IContainerManager : IDisposable {

		#region AddComponent
		void AddComponent<TService>(string key = "", ComponentLifeStyle lifeStyle = ComponentLifeStyle.Singleton);
		void AddComponent(Type type, string key = "", ComponentLifeStyle lifeStyle = ComponentLifeStyle.Singleton);
		void AddComponent<TService, TImplementation>(string key = "",
			ComponentLifeStyle lifeStyle = ComponentLifeStyle.Singleton);
		void AddComponent(Type service, Type implementation, string key = "",
			ComponentLifeStyle lifeStyle = ComponentLifeStyle.Singleton, params  Parameter[] parameters);
		void AddComponentInstance<TService>(object instance, string key = "");
		void AddComponentInstance(object instance, string key = "");
		void AddComponentInstance(Type service, object instance, string key = "");
		#endregion

		#region Resolve
		T Resolve<T>(string key = "", params Parameter[] parameters) where T : class;
		object Resolve(Type type, string key = "", params Parameter[] parameters);
		#endregion

		#region ResolveAll
		T[] ResolveAll<T>(string key = "");
		object[] ResolveAll(Type type, string key = "");
		#endregion

		#region TryResolve
		T TryResolve<T>(string key = "", params Parameter[] parameters);
		object TryResolve(Type type, string key = "", params Parameter[] parameters);
		#endregion

		#region ResolveUnRgeistered(未注册) 
		T ResolveUnregistered<T>() where T : class;
		object ResolveUnregistered(Type type);
		#endregion
	}
}
